package io.gitee.zhucan123.core.infrastructure.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * @author: zhuCan
 * @date: 2019-07-23 14:41
 * @description: 状态类型实体类 基类
 * <p>
 * code 值添加唯一键约束
 */
@EqualsAndHashCode(callSuper = true)
@Data
@EntityListeners(AuditingEntityListener.class)
@MappedSuperclass
@Table(uniqueConstraints = {@UniqueConstraint(columnNames = "code")})
public abstract class BaseStatusEntity extends BaseEntity {

  /**
   * 状态编码
   */
  @Column(name = "code", nullable = false)
  private Integer code;

  /**
   * 状态名称
   */
  @Column(name = "name", nullable = false, length = 20)
  private String name;

}
